import upload from '@/utils/upload'
import request from '@/utils/request'

// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
  const data = {
    oldPassword,
    newPassword
  }
  return request({
    url: '/system/user/profile/updatePwd',
    method: 'put',
    params: data
  })
}

// 查询用户个人信息
export function getUserProfile() {
  return request({
    url: '/system/user/profile',
    method: 'get'
  })
}

// 修改用户个人信息
export function updateUserProfile(data) {
  return request({
    url: '/system/user/profile',
    method: 'put',
    data: data
  })
}

// 用户头像上传
export function uploadAvatar(data) {
  return upload({
    url: '/system/user/profile/avatar',
    name: data.name,
    filePath: data.filePath
  })
}
// 传激活码 查数据 返回空就是没有这个激活码 激活失败 有数据 说明有这个激活码 然后判断这个数据里有没有激活人员 没有就是没用过
export function ActivationCodeslist(activationCode) {
  const data = {activationCode}
  return request({
    url: `/system/ActivationCodes/list`,
    method: 'get',
	params: data
  })
}
// 新增权益人信息
export function Beneficiaries(data) {
  return request({
	url: '/system/Beneficiaries',
    headers: {
      isToken: true
    },
    method: 'post',
    data: data
  })
}
// 证件类型字典值
export function document_type() {
  return request({
    url: '/system/dict/data/type/document_type',
    method: 'get'
  })
}

// 获取枚举只
export function meijuzhi(document_type) {
  return request({
    url: '/system/dict/data/type/'+document_type,
    method: 'get'
  })
}

//更新激活码状态
export function EditActivationCodes(data) {
  return request({
    url: '/system/ActivationCodes',
    method: 'put',
	headers: {
	  isToken: true
	},
	data: data
  })
}

//获取权益人信息
export function BeneficiariesList(data) {
  return request({
    url: '/system/Beneficiaries/list?phoneNumber='+data,
    method: 'get'
  })
}
//获取省份信息
export function provincelist() {
  return request({
    url: '/system/province/list?pageNum=1&pageSize=1000',
    method: 'get'
  })
}
//获取市信息
export function citylist(id) {
  return request({
    url: `/system/city/list?provinceId=${id}`,
    method: 'get'
  })
}


//获取专属权益
export function ProductPrivileges(id) {
  return request({
    url: `/system/ProductPrivileges/list?productID=${id}`,
    method: 'get'
  })
}


//获取医院
export function hospitalList(data) {
  return request({
    url: `/system/hospital/list?province=${data}&pageNum=1&pageSize=10000`,
    method: 'get'
  })
}

//获取市医院
export function hospitalList2(data) {
  return request({
    url: `/system/hospital/list?city=${data}&pageNum=1&pageSize=10000`,
    method: 'get'
  })
}

//保存预约信息
export function addAppointment(data) {
  return request({
	url: '/system/Appointment',
    headers: {
      isToken: true
    },
    method: 'post',
    data: data
  })
}

// 修改预约订单
export function updateAppointment(data) {
  return request({
    url: '/system/Appointment',
    method: 'put',
    data: data
  })
}

// 预约订单列表
export function AppointmentList(data) {
  return request({
    url: '/system/Appointment/list?contactNumber='+data,
    method: 'get'
  })
}

// 新增专属权益次数管理
export function addRecord(data) {
  return request({
    url: '/system/record',
    method: 'post',
    data: data
  })
}

// 修改专属权益次数管理
export function updateRecord(data) {
  return request({
    url: '/system/record',
    method: 'put',
    data: data
  })
}


// 修改专属权益次数管理
export function RecordList(data,id) {
  return request({
    url: '/system/record/list?activationCode='+data+'&exclusiveBenefitId='+id,
    method: 'get'
  })
}

export function sendSmsCode(phoneNumber) {
  return request({
    url: '/system/sms/sendSmsCode/',
    method: 'post',
    data: phoneNumber
  })
}
export function smsLogin(phoneNumber,code,uuid) {
  return request({
    url: '/system/sms/smsLogin',
    method: 'post',
    data: {phoneNumber,code,uuid}
  })
}

export function resetPwd(data) {
  return request({
    url: '/system/sms/resetPwd',
    method: 'post',
    data:data
  })
}